<script  setup>
  import { useRouter, } from 'vue-router'
  import { use_login_store } from '/src/stores/login.js'
  import { setup } from '/src/api/fetch_wrapper.js';

  const router=useRouter();

  const login_info=use_login_store();

  router.beforeEach((to, from) => {
  if (to.name == 'login') {
    return true;
  }
  // const user = JSON.parse(localStorage.getItem(`user`));
  if (login_info.get_token() != "") {
    return true;
  }
  return { name: 'login', query: { to: to.fullPath } };
  })

  setup(router);
  
</script>
<template>

  <router-view></router-view>
</template>
